// 随机数 [n, m]
export function randomNum(minNum, maxNum) {
  switch (arguments.length) {
    case 1:
      return Math.floor(Math.random() * minNum + 1);
    case 2:
      return Math.floor(Math.random() * (maxNum - minNum + 1) + minNum);
    default:
      return 0;
  }
}

const colors = [
  "#ed1941", "#1B9637", "#2E2AA4", "#ffe600",
  "#feeeed", "#5f3c23", "#5e7c85"];

export function generateRandomColor() {
  let index = randomNum(0, colors.length - 1);
  return colors[index];
}

export function getCurrentTime() {

  // 获取当前时间并打印
  let date = new Date();
  let yy = date.getFullYear();
  let mm = date.getMonth() + 1;
  let dd = date.getDate();
  let hh = date.getHours();
  let mf = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
  let ss = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
  // return yy + '-' + mm + '-' + dd + ' ' + hh + ':' + mf + ':' + ss;
  return hh + ':' + mf + ':' + ss;

}